/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = test_tibcoems_comm.c                                    */
/*  NOTE      =                                                    */
/*  DATE      = 2017/02/24 by songbb                               */
/*******************************************************************/

#include <stdio.h>

#include "conntrack.h"
#include "frct_comm.h"

#include <tibcoems/ems_core.h>
#include <tibcoems/ems_comm.h>

#include "apmtest_comm.h"
#include "test_tibcoems_comm.h"

extern int __ems_private_session_init(L7_session *p_st_session);

int test_ems_create_ct(Conntrack **pp_st_conn, char *src_ip,
                        char *dst_ip, unsigned short src_port, unsigned short dst_port)
{
    Conntrack *p_st_conn = NULL;
    L7_session *p_st_session = NULL;
    if (apmtest_create_ct(&p_st_conn, ems_session_destory, src_ip, dst_ip, src_port, dst_port) != FR_SUCC)
        goto error;

    p_st_session = frct_get_session(p_st_conn);
    if (__ems_private_session_init(p_st_session) != FR_SUCC)
        goto error;

    *pp_st_conn = p_st_conn;

    return FR_SUCC;
error:
    return FR_FAIL;
}

void test_ems_destroy_ct(Conntrack **pp_st_conn)
{
    apmtest_destroy_ct(pp_st_conn);
}
